﻿using DemoApp.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace DemoApp.ViewModels
{
    public class ColorItemViewModel : Common.BindableBase
    {
        public ColorItemViewModel(Models.ColorItem colorItem)
        {
            this.ColorItem = colorItem;
        }

        public Models.ColorItem ColorItem { get; private set; }

        public SolidColorBrush Brush { get { return new SolidColorBrush(this.ColorItem.Color); } }

        DelegateCommand _SelectCommand = null;
        public DelegateCommand SelectCommand
        {
            get
            {
                return _SelectCommand ?? (_SelectCommand = new DelegateCommand
                (
                    () => { App.EventAggregator.GetEvent<Messages.SelectColor>().Publish(this.ColorItem); },
                    () => { return true; }
                ));
            }
        }
    }
}
